#ifndef _PWM_H
#define _PWM_H

#include <REGF51RC.H>
#include "type.h"

#define pwmPin P2
#define pwmPin1 0x01
#define pwmPin2 0x02

typedef union _PWM_U
{
    uint8_t set8[2];
    uint16_t set16;
} PWM_U;

typedef struct _PWM
{
    uint8_t pin;
    PWM_U set;
} PWM;

void pwmInit(void);
void pwmSet(uint8_t ch, int16_t persent);
void pwmLevel(uint8_t ch, uint8_t level);
void pwmTigger(void);

#endif
